<script setup>
import { ref } from 'vue'

import { useAppStore } from '@/stores/modules/app'
import { useI18n } from 'vue-i18n'
const appStore = useAppStore()
const { t, locale } = useI18n()
const handleSetLanguage = () => {
  if (appStore.language === 'cn') {
    locale.value = 'en'
  } else {
    locale.value = 'cn'
  }

  appStore.setLanguage(locale.value)
  console.log(t('login.password'))
}
const input = ref('')
// const value1 = ref('')
</script>

<template>
  <main>
    <div class="demo">
      <p>{{ $t('login.password') }}-{{ appStore.language }}</p>

      <el-input v-model="input" style="width: 240px" />
      <el-button type="primary" @click="handleSetLanguage">修改翻译</el-button>
    </div>
  </main>
</template>

<style scoped lang="scss">
.demo {
  p {
    color: hsla(160, 100%, 37%, 1);
  }
}
</style>
